package com.example.nyf.web.system;

import com.example.nyf.common.AjaxResult;
import com.example.nyf.entity.SysRole;
import com.example.nyf.entity.SysUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

public class BaseController {

    public BaseController() {
    }

    /**
     * 返回 登录用户信息
     * @return
     */
    public SysUser getSysUser() {
        Subject object = SecurityUtils.getSubject();
        return (SysUser) object.getPrincipal();
    }

    /**
     * 返回json
     * @param msg
     * @return
     */
    public AjaxResult success(String msg) {
        return AjaxResult.success(msg);
    }

    public AjaxResult success(String msg, Object data) {
        return AjaxResult.success(msg, data);
    }

    public AjaxResult error(String msg) {
        return AjaxResult.error(msg);
    }


}
